package com.mars.nacos.api.controller;

import com.mars.nacos.api.dto.request.SmsSendDTO;
import com.mars.nacos.api.dto.response.UserOrderResDTO;
import com.mars.nacos.domain.service.OrderAppService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * @author : kyrie
 * @date : 2022/8/24 09:47
 * #desc    : some description
 */
@Api(tags = "订单中心测试API V2")
@Slf4j
@RestController
@RequestMapping("/order")
public class OrderAppV2Controller {
    @Resource
    private OrderAppService orderAppService;

    @GetMapping("/v2/orderNo")
    @ApiOperation(value = "获取订单号(V2)")
    public UserOrderResDTO getOrderNo() {
        return orderAppService.getOrderNo();
    }

    @PostMapping("/v1/sms/send")
    @ApiOperation(value = "发送短信")
    public String send(@RequestBody SmsSendDTO smsSendDTO) {
        return orderAppService.send(smsSendDTO);
    }

    @GetMapping("/v1/getUserByAge")
    @ApiOperation("获取指定年龄段的用户")
    public Integer getUserInfo(@RequestParam("age") Integer age) {
        return age;
    }


}
